@echo off
SETLOCAL

SET "arg1=%1"
SET "arg2=%2"
SET DOCKER_USERNAME=stan0105xx
SET DOCKER_PASSWORD=m1m@Other

echo logging Docker
call docker login --username %DOCKER_USERNAME% --password %DOCKER_PASSWORD% registry.cn-beijing.aliyuncs.com

echo mvn package
del "./script.jar"
call mvn -f ../pom.xml clean package

echo docker build
SET /A RAND_NUM=%RANDOM%
call docker build -t script:%RAND_NUM% .

echo docker del
call docker rmi -f registry.cn-beijing.aliyuncs.com/myself-space/script:master

echo docker tag
call docker tag script:%RAND_NUM% registry.cn-beijing.aliyuncs.com/myself-space/script:master

echo docker push
call docker push registry.cn-beijing.aliyuncs.com/myself-space/script:master

echo Success
ENDLOCAL

